To initiate the D11 window system, a standard Unix process ``bootstraps'' the active context for the D11 window system kernel. The process requests that the operating system create the D11 active context. The active context is a reserved range of user-space memory. The call to create an active context looks like:
fd = acattach("/tmp/.D11-ctx:0", AC_CREATE, 0x50000000, 0x10000000);This call creates an active context, ``attaches'' the active context to the calling process, and reserves a 256-megabyte range of virtual memory in a normally unallocated region of user address space. File system path names provides a convenient name space for active contexts, but active contexts are not otherwise reliant on the file system. Only privileged processes may create an active context.
The creator of an active context or a process running inside the active context can use the mmap family of system calls [12] to allocate, deallocate, and control memory within the active context. The effect of these calls is seen by all users of the active context. After an active context is created, the creator is expected to ``populate'' the context with text, read-only data, and writable data before enabling protected procedure calls to enter the active context.
The D11 bootstrap program mmaps the text and static data of the actual D11 window system kernel. The bootstrap program also establishes file descriptors, synchronization primitives (such as semaphores and spinlocks), and memory mappings for the graphics hardware and input devices.
The entry point for an active context is the address of initial execution when a process enters an active context via a protected procedure call. Initially, there is no entry point. The entry point to the active context is set by calling:
accontrol(fd, AC_SET_ENTRY, entry_func);entry_func is the address of the routine within the active context to be used as the active context entry point.
To make it possible for other processes on the system to attach to and make protected procedure calls into a newly created active context:
accontrol(fd, AC_ALLOW_ENTRY, /* true */ 1);must be called and an entry point must be established. The accontrol can be called only by the creator of an active context.